package com.ruoyi.web.controller.order;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.order.domain.MesProductSkipStation;
import com.ruoyi.order.service.IMesProductSkipStationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 异常跳站信息Controller
 * 
 * @author ruoyi
 * @date 2025-04-27
 */
@RestController
@RequestMapping("/order/skipStation")
public class MesProductSkipStationController extends BaseController
{
    @Autowired
    private IMesProductSkipStationService mesProductSkipStationService;

    /**
     * 查询异常跳站信息列表
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:list')")
    @GetMapping("/list")
    public TableDataInfo list(MesProductSkipStation mesProductSkipStation)
    {
        startPage();
        List<MesProductSkipStation> list = mesProductSkipStationService.selectMesProductSkipStationList(mesProductSkipStation);
        return getDataTable(list);
    }

    /**
     * 导出异常跳站信息列表
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:export')")
    @Log(title = "异常跳站信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MesProductSkipStation mesProductSkipStation)
    {
        List<MesProductSkipStation> list = mesProductSkipStationService.selectMesProductSkipStationList(mesProductSkipStation);
        ExcelUtil<MesProductSkipStation> util = new ExcelUtil<MesProductSkipStation>(MesProductSkipStation.class);
        util.exportExcel(response, list, "异常跳站信息数据");
    }

    /**
     * 获取异常跳站信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:query')")
    @GetMapping(value = "/{skipId}")
    public AjaxResult getInfo(@PathVariable("skipId") Long skipId)
    {
        return success(mesProductSkipStationService.selectMesProductSkipStationBySkipId(skipId));
    }

    /**
     * 新增异常跳站信息
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:add')")
    @Log(title = "异常跳站信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MesProductSkipStation mesProductSkipStation)
    {
        return toAjax(mesProductSkipStationService.insertMesProductSkipStation(mesProductSkipStation));
    }

    /**
     * 修改异常跳站信息
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:edit')")
    @Log(title = "异常跳站信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MesProductSkipStation mesProductSkipStation)
    {
        return toAjax(mesProductSkipStationService.updateMesProductSkipStation(mesProductSkipStation));
    }

    /**
     * 删除异常跳站信息
     */
    @PreAuthorize("@ss.hasPermi('order:skipStation:remove')")
    @Log(title = "异常跳站信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{skipIds}")
    public AjaxResult remove(@PathVariable Long[] skipIds)
    {
        return toAjax(mesProductSkipStationService.deleteMesProductSkipStationBySkipIds(skipIds));
    }
}
